//#define _CRT_SECURE_NO_WARNINGS 1
#include "Sort.h"

void test01()
{
	int a[] = { 2,4,7,5,8,9,10,12,6,13 };
	PrintArry(a, sizeof(a) / sizeof(a[0]));
	InsertSort(&a, sizeof(a) / sizeof(a[0]));
	/*for (int i = 0; i < 10; i++)
	{
		printf("%d ", a[i]);
	}*/
	PrintArry(a, sizeof(a) / sizeof(a[0]));
}

void test02()
{
	int a[] = { 2,4,7,5,8,9,10,12,6,13 };
	PrintArry(&a, sizeof(a) / sizeof(a[0]));
	ShellSort(&a, sizeof(a) / sizeof(a[0]));
	
	PrintArry(&a, sizeof(a) / sizeof(a[0]));
}

void test03()
{
	int a[] = { 2,4,7,5,8,9,10,12,6,13 };
	PrintArry(&a, sizeof(a) / sizeof(a[0]));
	SelectSort(&a, sizeof(a) / sizeof(a[0]));

	PrintArry(&a, sizeof(a) / sizeof(a[0]));
}

void test04()
{
	int a[] = { 2,4,7,5,8,9,10,12,6,13 };
	PrintArry(&a, sizeof(a) / sizeof(a[0]));
	HeapSort(&a, sizeof(a) / sizeof(a[0]));

	PrintArry(&a, sizeof(a) / sizeof(a[0]));
}

void test05()
{
	int a[] = { 2,4,7,5,8,9,10,12,6,13 };
	PrintArry(&a, sizeof(a) / sizeof(a[0]));
	BubbleSort(&a, sizeof(a) / sizeof(a[0]));

	PrintArry(&a, sizeof(a) / sizeof(a[0]));
}

void test06()
{
	int a[] = { 2,4,7,5,8,9,10,12,6,13 };
	PrintArry(&a, sizeof(a) / sizeof(a[0]));
	QuickSortNonR(&a, 0, sizeof(a) / sizeof(a[0])-1);
	//QuickSort(&a, 0, sizeof(a) / sizeof(a[0])-1);
	//QuickSort1(&a, 0, sizeof(a) / sizeof(a[0])-1);
	//QuickSort2(&a, 0, sizeof(a) / sizeof(a[0])-1);

	PrintArry(&a, sizeof(a) / sizeof(a[0]));
}

void test07()
{
	int a[] = { 2,4,7,5,8,9,10,12,1,3,14,13,15,11};
	PrintArry(&a, sizeof(a) / sizeof(int));
	//MergeSort(&a, sizeof(a) / sizeof(int));
	MergeSortNonR(&a, sizeof(a) / sizeof(int));

	PrintArry(&a, sizeof(a) / sizeof(int));
}

void test08()
{
	int a[] = { 2,4,7,5,8,9,10,12,13,15,14,11,3,-1};
	PrintArry(&a, sizeof(a) / sizeof(int));
	CountSort(&a, sizeof(a) / sizeof(int));

	PrintArry(&a, sizeof(a) / sizeof(int));
}

int func(int n)
{
	if (n <= 1)
	{
		return n;
	}
	return func(n - 1) + n;
}

int main()
{
	//test01();
	//test02();
	//test03();
	//test04();
	//test05();
	//test06();
	//printf("%d\n", func(10));
	//test07();
	test08();

	return 0;
}